/*************************************************************/
/*   Headers for the stress of a neo-hookean finite strain   */
/*    Initially based on ComputeFiniteStrainElasticStress    */
/*                  Status: not working                      */
/*                                                           */
/* Copyright (C) 2018  eDgar                                 */
/*                                                           */
/* This program is free software: you can redistribute it    */
/* and/or modify it under the terms of the GNU General       */
/* Public License as published by the Free Software          */
/* Foundation, either version 3 of the License, or (at your  */
/* option) any later version.                                */
/*                                                           */
/* This program is distributed in the hope that it will be   */
/* useful, but WITHOUT ANY WARRANTY; without even the        */
/* implied warranty of MERCHANTABILITY or FITNESS FOR A      */
/* PARTICULAR PURPOSE.  See the GNU General Public License   */
/* for more details.                                         */
/*                                                           */
/* You should have received a copy of the GNU General Public */
/* License along with this program.  If not, see             */
/* <http://www.gnu.org/licenses/>.                           */
/*************************************************************/


#ifndef COMPUTESTRESSNEOHOOKEAN_H
#define COMPUTESTRESSNEOHOOKEAN_H

#include "ComputeStressBase.h"
#include "GuaranteeConsumer.h"

class ComputeStressNeohookean;

template <>
InputParameters validParams<ComputeStressNeohookean>();

/**
 * ComputeStressNeohookean computes the stress by the push-forward
 * of the second Piola-Kirchhoff stress
 * \begin{align}
 *    \sigma_{ij} = \frac{1}{J}\cdot\left(
 *      \lambda_{0}\cdot\ln{\left(J\right)}\cdot\delta_{ij}
 *       + \mu_{0}\cdot \left(B_{ij}
 *          - \delta_{ij}\right)
 *    \right)
 *  \end{align}
 */
class ComputeStressNeohookean : public ComputeStressBase, public GuaranteeConsumer
{
public:
  ComputeStressNeohookean(const InputParameters & parameters);

  void initialSetup() override;

protected:
  virtual void initQpStatefulProperties() override;
  virtual void computeQpStress() override;

  ///////////////////////////////////////
  // Repeated code from                //
  // ComputeElasticityTensorNeohookean //
  ///////////////////////////////////////

  /*
   * This code is commented, because I am going to hard code
   * parameters to see if that fixes issues with the coupon
   */
  // // Variables to test whether or not the parameters were
  // // given (repeated code from
  // // ComputeElasticityTensorNeohookean)
  // const bool _lambda_set;
  // const bool _mu_set;
  // const bool _nu_set;
  // const bool _E_set;

  // These are just material properties which don't change
  // /**
  //  * Lamé constants \lambda and \mu: \lambda > 0, \mu > 0
  //  */
  // Real _lambda;
  // Real _mu;
  // /**
  //  * Poisson's ratio and Young's modulus: -1 < \nu < 0.5,
  //  *  E > 0
  //  */
  // const Real _nu;
  // const Real _E;

  // All of the const MaterialProperties below have already
  // been calculated elsewhere, and need not to be modified,
  // thus can be declared as constants.

  // I will try to use the deformation gradient from
  // ComputeFiniteStrain, in a similar way as it is done in
  // FiniteStrainCrystalPlasticity
  const
  MaterialProperty<RankTwoTensor> & _deformation_gradient;

  // // "You can declare material property for J_1 in the
  // // ComputeElasticityTensorNeohookean.C and get material
  // // property J_1 in ComputeStressNeohookean.C." --Wen Jiang
  // //
  // // I hope that this is the way to declare a variable
  // // to later take a value from
  // // ComputeElasticityTensorNeohookean
  // const MaterialProperty<Real> & _J_1;
  // const MaterialProperty<Real> & _logJ;

  ///////////////////////////////////////
  // -- end Repeated code              //
  ///////////////////////////////////////

  // // See note about "Rotate the stress" in source code
  // // (following ComputeFiniteStrainElasticStress.C and
  // // ComputeFiniteStrain::computeQpIncrements).
  // const
  // MaterialProperty<RankTwoTensor> & _rotation_increment;
};

#endif // COMPUTESTRESSNEOHOOKEAN_H
